
#ifndef _C_COMMON_H_
#define _C_COMMON_H_

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>

#define DBG(a, b...) fprintf(stderr, "DBG:"a"\r\n", ##b);

typedef void (*C_Mem_Free_t)(void*);

typedef void* C_Handle_t;

#define C_True		1
#define C_False		0
typedef char C_Bool_t;

typedef enum
{
	C_ERR_NOERR = 0,
	C_ERR_NOMEM,
	C_ERR_INVALID_STATE,
	C_ERR_INVALID_PARAMS,
	C_ERR_TIMEOUT,
	C_ERR_INTERNAL_ERR,

	C_ERR_MAX,
} C_Error_t;

const char*
C_ErrMsg(C_Error_t);

void*
C_Malloc(size_t);

void
C_Free(void*);

void
C_Get_Time(struct timespec*);

void
C_Add_Time(struct timespec*, size_t ms);

#endif
